home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 2
/
Gold Medal Software Volume 2 (Gold Medal) (1994).iso
/
windows
/
win31
/
macsyma.arj
/
MACSDEMO.EXE
/
OPALG.OUT
< prev
next >
Wrap
Text File
|
1993-09-13
|
8KB
|
213 lines
(c1) /* DEMONSTRATION OF THE OPERATOR ALGEBRA PACKAGE `OPALG'
Copyright (c) 1988, 1987, 1986 Symbolics, Inc.
Portions copyright (c) 1986, 1985 GTE Laboratories Incorporated.
*/
if get('opalg,'version) = false then load(opalg)$
C:\MACSD2B\share\OPALG.fas being loaded.
(c2) /* Make sure USE_OPERATORS is turned on. */
use_operators:true$
(c3) /*
BASIC OPERATIONS ON OPERATORS
*/
/* Addition of operators */
(u + v + w)(x);
|$label(0,15,Times New Roman,$(d3$))w$paren(x)$hinge()$in( + )v$paren(x)$hinge()$in( + )u$paren(x)
(c4) /* Composition of operators */
(u . v . w)(x);
|$label(0,15,Times New Roman,$(d4$))u$paren(v$paren(w$paren(x)))
(c5) /* Scalar multiplication of a operator by a scalar */
(2 * u)(x);
|$label(0,15,Times New Roman,$(d5$))2$hinge()$in( )u$paren(x)
(c6) (u^^3)(x);
|$label(0,15,Times New Roman,$(d6$))u$paren(u$paren(u$paren(x)))
(c7) declare(c,opscalar)$
(c8) (u + c)(x);
|$label(0,15,Times New Roman,$(d8$))u$paren(x)$hinge()$in( + )c$in( )x
(c9) (c^2 * u)(x);
|$label(0,15,Times New Roman,$(d9$))$sup(c,2)$hinge()$in( )u$paren(x)
(c10) /* 1 serves as the identity operator here. */
1(x);
|$label(0,15,Times New Roman,$(d10$))x
(c11) /* Operators applied to more than one argument */
(u + v + w)(x, y);
|$label(0,15,Times New Roman,$(d11$))w$paren(x$ina($, )$hinge()y)$hinge()$in( + )v$paren(x$ina($, )$hinge()y)$hinge()$in( + )u$paren(x$ina($, )$hinge()y)
(c12) (u . v . w)(x, y);
|$label(0,15,Times New Roman,$(d12$))u$paren(v$paren(w$paren(x$ina($, )y)))
(c13) /* The following operations on operators are left undefined */
(u * v)(x);
|$label(0,15,Times New Roman,$(d13$))u$in( )v$paren(x)
(c14) (u^2)(x);
|$label(0,15,Times New Roman,$(d14$))$sup(u,2)$paren(x)
(c15) /* The Differentiation Operator DIFFOP */
diffop(x,2) + diffop(x);
|$label(0,15,Times New Roman,$(d15$))$q($sup(d,2),d$sup(x,2))$hinge()$in( + )$q(d,dx)
(c16) %(x^5);
|$label(0,15,Times New Roman,$(d16$))5$in( )$sup(x,4)$hinge()$in( + )20$in( )$sup(x,3)
(c17) diffop(x,1,y,2);
|$label(0,15,Times New Roman,$(d17$))$q($sup(d,3),dx d$sup(y,2))
(c18) /* The Integration Operator INTEGOP */
integop(x)^^2 + integop(x);
|$label(0,15,Times New Roman,$(d18$))$sup($paren($integrate(,x,,),$(,$)),$paren(2,<,>))$hinge()$in( + )$integrate(,x,,)
(c19) %(x^5);
|$label(0,15,Times New Roman,$(d19$))$q($sup(x,7),42)$hinge()$in( + )$q($sup(x,6),6)$hinge()$in( + )%integconst2$in( )x$hinge()$in( + )%integconst3$hinge()$in( + )%integconst1
(c20) /* Definite integration */
integop(x,2,4);
|$label(0,15,Times New Roman,$(d20$))$integrate(,x,2,4)
(c21) %(x^2);
|$label(0,15,Times New Roman,$(d21$))$q(56,3)
(c22) /* The Constant Operator CONSTOP */
constop(a);
|$label(0,15,Times New Roman,$(d22$))$sub(C,<a>)
(c23) %(x,y,z);
|$label(0,15,Times New Roman,$(d23$))a
(c24) diffop(x) . integop(x);
|$label(0,15,Times New Roman,$(d24$))1
(c25) %(x^2);
|$label(0,15,Times New Roman,$(d25$))$sup(x,2)
(c26) integop(x) . diffop(x);
|$label(0,15,Times New Roman,$(d26$))$sub(C,<%integconst4>)$hinge()$in( + )1
(c27) %(x^2);
|$label(0,15,Times New Roman,$(d27$))$sup(x,2)$hinge()$in( + )%integconst4
(c28) /*
SAMPLE MANIPULATIONS
*/
diffop(x,2) + diffop(x);
|$label(0,15,Times New Roman,$(d28$))$q($sup(d,2),d$sup(x,2))$hinge()$in( + )$q(d,dx)
(c29) op1: multthru(diffop(x,3) . %);
|$label(0,15,Times New Roman,$(d29$))$q($sup(d,5),d$sup(x,5))$hinge()$in( + )$q($sup(d,4),d$sup(x,4))
(c30) %(x^10);
|$label(0,15,Times New Roman,$(d30$))5040$in( )$sup(x,6)$hinge()$in( + )30240$in( )$sup(x,5)
(c31) integop(x);
|$label(0,15,Times New Roman,$(d31$))$integrate(,x,,)
(c32) op2: 2 * % + op1;
|$label(0,15,Times New Roman,$(d32$))$q($sup(d,5),d$sup(x,5))$hinge()$in( + )$q($sup(d,4),d$sup(x,4))$hinge()$in( + )2$in( )$integrate(,x,,)
(c33) %(x^5);
|$label(0,15,Times New Roman,$(d33$))2$in( )$paren($q($sup(x,6),6)$in( + )%integconst5,$(,$))$hinge()$in( + )120$in( )x$hinge()$in( + )120
(c34) multthru(diffop(x) . op2);
|$label(0,15,Times New Roman,$(d34$))$q($sup(d,6),d$sup(x,6))$hinge()$in( + )$q($sup(d,5),d$sup(x,5))$hinge()$in( + )2
(c35) op2^^2;
|$label(0,15,Times New Roman,$(d35$))$sup($open($()$q($sup(d,5),d$sup(x,5))$hinge()$in( + )$q($sup(d,4),d$sup(x,4))$hinge()$in( + )2$in( )$integrate(,x,,)$close($)),$paren(2,<,>))
(c36) expand(%);
|$label(0,15,Times New Roman,$(d36$))4$in( )$sup($paren($integrate(,x,,),$(,$)),$paren(2,<,>))$hinge()$in( + )$q($sup(d,10),d$sup(x,10))$hinge()$in( + )2$in( )$q($sup(d,9),d$sup(x,9))$hinge()$in( + )$q($sup(d,8),d$sup(x,8))$hinge()$in( + )4$in( )$q($sup(d,4),d$sup(x,4))$hinge()$in( + )4$in( )$q($sup(d,3),d$sup(x,3))$hinge()$in( + )2$in( )$sub(C,<%integconst7>)$hinge()$in( + )2$in( )$sub(C,<%integconst6>)
(c37) op3: a . diffop(x,2);
|$label(0,15,Times New Roman,$(d37$))a$hinge()$in( . )$q($sup(d,2),d$sup(x,2))
(c38) %(x^5);
|$label(0,15,Times New Roman,$(d38$))a$paren(20$in( )$sup(x,3))
(c39) declare(a,opscalar)$
(c40) op3(x^5);
|$label(0,15,Times New Roman,$(d40$))20$hinge()$in( )a$hinge()$in( )$sup(x,3)
(c41) /*
A SAMPLING OF BUILT-IN SIMPLIFICATIONS
*/
diffop(x,1,y,0,z,2);
|$label(0,15,Times New Roman,$(d41$))$q($sup(d,3),dx d$sup(z,2))
(c42) diffop(x,0);
|$label(0,15,Times New Roman,$(d42$))1
(c43) diffop(x,i) . diffop(y,j) . diffop(x,k);
|$label(0,15,Times New Roman,$(d43$))$q($sup(d,k$in( + )j$in( + )i),d$sup(x,k$in( + )i) d$sup(y,j))
(c44) diffop(x,m,y,n)^^i;
|$label(0,15,Times New Roman,$(d44$))$q($sup(d,i$in( )n$in( + )i$in( )m),d$sup(x,i$in( )m) d$sup(y,i$in( )n))
(c45) diffop(x,i) . integop(x);
|$label(0,15,Times New Roman,$(d45$))$q($sup(d,i$in( - )1),d$sup(x,i$in( - )1))
(c46) integop(x) . diffop(x,i);
|$label(0,15,Times New Roman,$(d46$))$q($sup(d,i$in( - )1),d$sup(x,i$in( - )1))$hinge()$in( + )$sub(C,<%integconst8>)
(c47) diffop(x,-3);
|$label(0,15,Times New Roman,$(d47$))$sup($paren($integrate(,x,,),$(,$)),$paren(3,<,>))
(c48) constop(c) . anything;
|$label(0,15,Times New Roman,$(d48$))$sub(C,<c>)
(c49) constop(c)^^2;
|$label(0,15,Times New Roman,$(d49$))$sub(C,<c>)
(c50) /*
AN EXTENDED EXAMPLE
*/
/* Test that two operator expressions give the same results. */
declare(f,opscalarfun)$
(c51) op4: diffop(x) . f(x);
|$label(0,15,Times New Roman,$(d51$))$q(d,dx)$hinge()$in( . )f$paren(x)
(c52) /* Note the new partial differentiation representation in the following. */
op5: f(x) . diffop(x) + diff(f(x),x);
|$label(0,15,Times New Roman,$(d52$))f$paren(x)$in( . )$q(d,dx)$hinge()$in( + )$sup(f,$paren(1))$paren(x)
(c53) res1: op4(sin(x));
|$label(0,15,Times New Roman,$(d53$))$sup(f,$paren(1))$paren(x)$in( )sin$paren(x)$hinge()$in( + )f$paren(x)$in( )cos$paren(x)
(c54) res2: op5(sin(x));
|$label(0,15,Times New Roman,$(d54$))$sup(f,$paren(1))$paren(x)$in( )sin$paren(x)$hinge()$in( + )f$paren(x)$in( )cos$paren(x)
(c55) /* Generate a rule */
matchdeclare(s,opscalarp,y,true)$
(c56) tellsimpafter(diffop(y) . s, s . diffop(y) + diff(s,y))$
(c57) declare(x,opscalar,n,integer)$
(c58) diffop(x) . x^n;
|$label(0,15,Times New Roman,$(d58$))$sup(x,n)$in( . )$q(d,dx)$hinge()$in( + )n$in( )$sup(x,n$in( - )1)
(c59) %(sin(x));
|$label(0,15,Times New Roman,$(d59$))n$in( )$sup(x,n$in( - )1)$in( )sin$paren(x)$hinge()$in( + )$sup(x,n)$in( )cos$paren(x)
(c60) res1, f(x) := x^n;
|$label(0,15,Times New Roman,$(d60$))n$in( )$sup(x,n$in( - )1)$in( )sin$paren(x)$hinge()$in( + )$sup(x,n)$in( )cos$paren(x)
(c61) /* To clean up if so desired, type (some subset of) the following:
remove([c,a,x],opscalar,n,integer,f,opscalarfun,[s,y],matchdeclare,
[op1,op2,op3,op4,op5,res1,res2],value);
reset(integconstnum)$
remrule(".",all)$
More precisely, remove the most recent rule assigned to the operator "." .
*/